/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListPDSTablaAutentificacionData {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Cliente...");
		orm.Cliente[] ormClientes = lDAOFactory.getClienteDAO().listClienteByQuery(null, null);
		int length = Math.min(ormClientes.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormClientes[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Tarjeta...");
		orm.Tarjeta[] ormTarjetas = lDAOFactory.getTarjetaDAO().listTarjetaByQuery(null, null);
		length = Math.min(ormTarjetas.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormTarjetas[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Coordenadas...");
		orm.Coordenadas[] ormCoordenadases = lDAOFactory.getCoordenadasDAO().listCoordenadasByQuery(null, null);
		length = Math.min(ormCoordenadases.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormCoordenadases[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Cliente by Criteria...");
		orm.ClienteCriteria clienteCriteria = new orm.ClienteCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//clienteCriteria.id_cliente.eq();
		clienteCriteria.setMaxResults(ROW_COUNT);
		orm.Cliente[] ormClientes = clienteCriteria.listCliente();
		int length =ormClientes== null ? 0 : Math.min(ormClientes.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormClientes[i]);
		}
		System.out.println(length + " Cliente record(s) retrieved."); 
		
		System.out.println("Listing Tarjeta by Criteria...");
		orm.TarjetaCriteria tarjetaCriteria = new orm.TarjetaCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//tarjetaCriteria.id_tarjeta.eq();
		tarjetaCriteria.setMaxResults(ROW_COUNT);
		orm.Tarjeta[] ormTarjetas = tarjetaCriteria.listTarjeta();
		length =ormTarjetas== null ? 0 : Math.min(ormTarjetas.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormTarjetas[i]);
		}
		System.out.println(length + " Tarjeta record(s) retrieved."); 
		
		System.out.println("Listing Coordenadas by Criteria...");
		orm.CoordenadasCriteria coordenadasCriteria = new orm.CoordenadasCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//coordenadasCriteria.id_coordenada.eq();
		coordenadasCriteria.setMaxResults(ROW_COUNT);
		orm.Coordenadas[] ormCoordenadases = coordenadasCriteria.listCoordenadas();
		length =ormCoordenadases== null ? 0 : Math.min(ormCoordenadases.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormCoordenadases[i]);
		}
		System.out.println(length + " Coordenadas record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListPDSTablaAutentificacionData listPDSTablaAutentificacionData = new ListPDSTablaAutentificacionData();
			try {
				listPDSTablaAutentificacionData.listTestData();
				//listPDSTablaAutentificacionData.listByCriteria();
			}
			finally {
				orm.PDSTablaAutentificacionPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
